def sum_num(num):
    print(num)
    # 递归的出口很重要，否则会出现死循环
    if num == 1:
        return
    
    sum_num(num-1)
    print("finish %d" % num)

sum_num(3)